package day07.ui;

import day07.entity.User;
import day07.service.UserService;
import day07.service.impl.UserServiceImpl;

import java.util.List;

public class ApplicationStarter {
    public static void main(String[] args) {
        UserService userService = new UserServiceImpl();
        // 添加
        User user = new User(1L, "Hanserwu", "123456", "上海");
        int save = userService.save(user);
        // 修改
        User updateUser = User.builder().id(1L).name("hanserwu").password("654321").address("四川").build();
        int update = userService.update(updateUser);
        // 删除
        int delete = userService.delete(user);
        // 查询所有
        List<User> users = userService.queryAll();
        System.out.println(users);
        // 查询单个
        User user1 = userService.queryById(1L);
        System.out.println(user1);
    }
}
